             package com.java.diagnostics.visualizer.gc.realtimeV2.parser;
             
             import com.java.diagnostics.visualizer.data.StructuredData;
             import com.java.diagnostics.visualizer.data.TupleDataBuilder;
             import com.java.diagnostics.visualizer.data.axes.AxisPair;
             import com.java.diagnostics.visualizer.factory.DataFactory;
             import com.java.diagnostics.visualizer.gc.realtime.util.Messages;
             import com.java.diagnostics.visualizer.metadata.TupleMetaData;
             import com.java.diagnostics.visualizer.metadata.TupleMetaData.TableType;
             import com.java.diagnostics.visualizer.parser.vgc.converters.EventUnitConverter;
             import java.util.Date;
             import java.util.Map;
             
             public class GCEventHandler
             {
               public static final String HEARTBEAT = "heartbeat";
               public static final String SYNCHGC = "synchgc";
               static final String SYSGC = "sys";
               static final String OOM_GARBAGE_COLLECT = "OOM GC";
               static final String VM_SHUTDOWN_GARBAGE_COLLECT = "shutdown GC";
               public static final String TRIGGER_START = "trigger start";
               public static final String TRIGGER_END = "trigger end";
               public static final String CYCLE_START = "cycle start";
               public static final String CYCLE_END = "cycle end";
               public static final String QUANTUM = "quantum";
               static final String EVENT_UTIL_OVERFLOW = "utilization tracker overflow";
               static final String EVENT_NON_MONOTONIC = "non-monotonic time acknowledged";
               static final String EVENT_OOM = "out of memory";
               static final String EVENT_OVERFLOW_OCCURRED = "overflow occured";
               static final String NON_DETERMINISTIC_SWEEP = "non-deterministic sweep";
               static final int HEARTBEAT_EVENT = 0;
               static final int SYNCH_GC_EVENT = 1;
               static final int SYSTEM_GARBAGE_COLLECT_EVENT = 2;
               static final int OOM_GARBAGE_COLLECT_EVENT = 13;
               static final int VM_SHUTDOWN_GARBAGE_COLLECT_EVENT = 14;
               static final int TRIGGER_START_EVENT = 12;
               static final int TRIGGER_END_EVENT = 3;
               static final int CYCLE_START_EVENT = 4;
               static final int CYCLE_END_EVENT = 5;
               static final int UTIL_OVERFLOW_EVENT = 6;
               static final int NON_MONOTONIC_EVENT = 7;
               static final int OOM_EVENT = 9;
               static final int GC_OVERFLOW_EVENT = 10;
               static final int NON_DETERMINISTIC_SWEEP_EVENT = 15;
               final EventUnitConverter eventConverter;
               final StructuredData events;
               final TupleDataBuilder gcActivity;
               final TupleDataBuilder eventIds;
               private final StoredPoints points = new StoredPoints(20);
               
               GCEventHandler(DataFactory factory, EventUnitConverter eventConverter, AxisPair activityPair, AxisPair discreteNumberPair) {
                 this.events = factory.createStructuredData("RealtimeLabels.events", Messages.getString("RealtimeLabels.events"));
                 this.gcActivity = factory.createTupleData("RealtimeLabels.gc.activity", Messages.getString("RealtimeLabels.gc.activity"), activityPair);
                 this.gcActivity.setTupleMetaData(new TupleMetaData(TupleMetaData.TableType.FREQUENCY, null));
                 this.eventIds = factory.createTupleData("RealtimeLabels.event.id", Messages.getString("RealtimeLabels.event.id"), discreteNumberPair);
                 this.eventIds.setTupleMetaData(new TupleMetaData(TupleMetaData.TableType.COUNT, null));
                 this.eventConverter = eventConverter;
               }
               
               void handleCurrentEvent(String eventLabel, int eventConstant, long timeMillis, String currentComment)
               {
                 int eventValue = this.eventConverter.getValue(eventConstant, eventLabel);
                 this.gcActivity.addDataPoint(eventValue, currentComment);
                 this.events.getContents().put(eventLabel, new Date(timeMillis));
               }
               
               void handleEvent(String eventLabel, int eventConstant, long timeMillis, String currentComment)
               {
                 int eventValue = this.eventConverter.getValue(eventConstant, eventLabel);
                 this.points.storePoint(this.gcActivity, eventValue, currentComment);
                 this.events.getContents().put(eventLabel, new Date(timeMillis));
               }
               
               void handleCurrentGCActivity(String eventLabel, int eventConstant, long id, String currentComment)
               {
                 int eventValue = this.eventConverter.getValue(eventConstant, eventLabel);
                 this.gcActivity.addDataPoint(eventValue, currentComment);
                 if (id >= 0L) {
                   this.eventIds.addDataPoint(id, currentComment);
                 }
               }
               
               void handleGCActivity(String eventLabel, int eventConstant, long id, String currentComment)
               {
                 int eventValue = this.eventConverter.getValue(eventConstant, eventLabel);
                 if (id >= 0L) {
                   this.points.storePoint(this.eventIds, id, currentComment);
                 }
                 this.points.storePoint(this.gcActivity, eventValue, currentComment);
               }
               
               void complete() {
                 this.points.complete();
               }
             }


